﻿@using ChampionsLeagueBets.Web.Mvc.Controllers.ViewModels
@model TournamentViewModel


@{
	ViewBag.Title = Model.Tournament.Name + ": " + Model.User.FullName;
	ViewBag.Image = "~/Content/images/dollars-64.png";
}


<div id="content" style="min-height: 220px">

	@foreach (var key in Model.GamesDictionary.Keys)
	{
		int j = 0;
		<div class="game-date">@key.ToShortDateString()</div>
		<table class="grid">
		<thead>
			<tr>
				<th>Gospodarz</th>
				<th>Goście</th>
				<th>Bramki gospodarze</th>
				<th>Bramki goście</th>
				<th>Wynik - bramki gospodarze</th>
				<th>Wynik - bramki goście</th>
				<th>Punkty</th>
			</tr>
		</thead>

		@foreach (var item in Model.GamesDictionary[key])
		{
			j++;
			<tr class="@(j % 2 == 0 ? "row-normal" : "row-grayed" )">
				<td>@item.Game.TeamHost</td>
				<td>@item.Game.TeamGuest</td>
				@if (DateTime.Now <= key)
				{
					<td></td>
					<td></td>
				}
				else
				{
					<td>@item.ResultTeamHost</td>
					<td>@item.ResultTeamGuest</td>						
				}

				<td>@item.Game.ResultTeamHost</td>
				<td>@item.Game.ResultTeamGuest</td>
				<td>
					@if(item.Points == null)
					{
						@* Brak wyniku *@
						<strong>-</strong>
					}
					else
					{
						@* Punkty *@
						<strong>@item.Points</strong>
					}
				</td>
			</tr>
		}
		</table>
	}

</div>
<div class="ui-actions">
	@(Html.ActionLink<TournamentsController>(c => c.Classification(Model.Tournament.Id), "Anuluj", new { @class = "link-button" }))
</div>


